package com.yao.exceptionHandler;

import com.yao.common.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionHandler {

    private static final Logger log = LoggerFactory.getLogger(ExceptionHandler.class);

    @org.springframework.web.bind.annotation.ExceptionHandler(Exception.class)
    public Result<Object> exceptionHandler(Exception ex){
        log.error("异常信息: {}", ex.getMessage());
        return Result.error(ex.getMessage());
    }
}
